﻿<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="/favicon.ico">
<LINK rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="${ctxPath}/r/lib/html5.js"></script>
<script type="text/javascript" src="${ctxPath}/r/lib/respond.min.js"></script>
<script type="text/javascript" src="${ctxPath}/r/lib/PIE_IE678.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css"
	href="${ctxPath}/r/system/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css"
	href="${ctxPath}/r/system/h-ui/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css"
	href="${ctxPath}/r/lib/Hui-iconfont/1.0.7/iconfont.css" />
<link rel="stylesheet" type="text/css"
	href="${ctxPath}/r/lib/icheck/icheck.css" />
<link rel="stylesheet" type="text/css"
	href="${ctxPath}/r/system/h-ui/skin/default/skin.css" id="skin" />
<!--[if IE 6]>
<script type="text/javascript" src="${ctxPath}/r/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>内容列表</title>
</head>
<body>
	<div class="page-container"  style="padding:0px 20px 20px 20px">
		<div class="cl pd-5  mt-20">
			<span class="l"> <a href="javascript:;"
				onclick="admin_add('添加模型','${ctxPath}/system/model/input','800','500')"
				class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i>
					添加内容</a></span> <span class="r">共有数据：<strong>${contentPage.totalRow!}</strong>
				条
			</span>
		</div>
		<table class="table table-border table-bordered table-bg">
			<thead>
				<tr class="text-c">
					<th width="20">Id</th>
					<th width="180">标题</th>
					<th width="60">发布时间</th>
					<th width="60">作者</th>
					<th width="60">来源</th>
					<th width="60">审核状态</th>
					<th width="80">操作</th>
				</tr>
			</thead>
			<tbody>
			@for(content in contentPage.list){
				<tr class="text-c va-m">
					<td>${content.contentId!}</td>
					<td>${content.title!}</td>
					<td>${content.inputdate!}</td>
					<td>${content.username!}</td>
					<td>${content.Source!}</td>
					<td class="td-status">
					@if(content.Status){ 
					<span class="label label-success radius">已审核</span> 
					@}else{
					 <span class="label label-default radius">未审核</span>
					@}
					</td>
					<td class="td-manage"> 
					@if(content.Status){
					 <a style="text-decoration: none"
						onClick="model_start(this,'${content.contentId!}')" href="javascript:;"
						title="通过"><i class="Hui-iconfont">&#xe631;</i></a> 
					@}else{ 
						<a style="text-decoration: none" onClick="model_stop(this,'${content.contentId!}')"
						href="javascript:;" title="不通过"><i class="Hui-iconfont">&#xe631;</i></a> 
					@}
						
						<a title="编辑" href="javascript:;"
						onclick="model_edit('模型编辑','${ctxPath}/system/model/input/${content.contentId!}','1','800','500')"
						class="ml-5" style="text-decoration: none"><i
							class="Hui-iconfont">&#xe6df;</i></a> <a title="删除"
						href="javascript:;" onclick="admin_del(this,'${content.contentId!}')"
						class="ml-5" style="text-decoration: none"><i
							class="Hui-iconfont">&#xe6e2;</i></a></td>
				</tr>
				@}
			</tbody>
		</table>
		<div id="pagenate"
			style="padding: 5px; text-align: center; margin: 0 auto;"></div>
	</div>
	<script type="text/javascript"
		src="${ctxPath}/r/lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript"
		src="${ctxPath}/r/lib/layer/2.1/layer.js"></script>
	<script type="text/javascript"
		src="${ctxPath}/r/lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript"
		src="${ctxPath}/r/lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript"
		src="${ctxPath}/r/system/h-ui/js/H-ui.js"></script>
	<script type="text/javascript"
		src="${ctxPath}/r/system/h-ui/js/H-ui.admin.js"></script>
	<script type="text/javascript">
	
      $(function(){
    		laypage({
    			cont : document.getElementById('pagenate'),
    			pages : ${contentPage.totalPage!}, //可以叫服务端把总页数放在某一个隐藏域，再获取。假设我们获取到的是18
    			curr : ${contentPage.pageNumber!},
    			jump : function(e, first) { //触发分页后的回调
    				if (!first) { //一定要加此判断，否则初始时会无限刷新
    					location.href = '${ctxPath}/system/content/list/${catId!}-' + e.curr;
    				}
    			}
    		});
      });
		/*
		 参数解释：
		 title	标题
		 url		请求的url
		 id		需要操作的数据id
		 w		弹出层宽度（缺省调默认值）
		 h		弹出层高度（缺省调默认值）
		 */
		/*模型-增加*/
		function admin_add(title, url, w, h) {
			layer_show(title, url, w, h);
		}
		/*模型-删除*/
		function admin_del(obj, id) {
			layer.confirm('确认要删除吗？', function(index) {
				//此处请求后台程序，下方是成功后的前台处理……
				$.post("${ctxPath}/system/model/del/"+id,
                function(data){
					 $(obj).parents("tr").remove();
						layer.msg('删除成功!', {
							icon : 1,
							time : 1000
						});
                });
				
			});
		}
		/*模型-编辑*/
		function model_edit(title, url, id, w, h) {
			layer_show(title, url, w, h);
		}
		/*模型-停用*/
		function model_stop(obj, id) {
			layer.confirm('确认要停用吗？',
							function(index) {
							//此处请求后台程序，下方是成功后的前台处理……
                            $.post("${ctxPath}/system/model/status/"+id,
                            function(data){ 
                            	$(obj)
								.parents("tr")
								.find(".td-manage")
								.prepend(
										'<a onClick="model_start(this,'+id+')" href="javascript:;" title="启用" style="text-decoration:none"><i class="Hui-iconfont">&#xe615;</i></a>');
						        $(obj)
								.parents("tr")
								.find(".td-status")
								.html(
										'<span class="label label-default radius">已禁用</span>');
						$(obj).remove();
						layer.msg('已停用!', {
							icon : 5,
							time : 1000
						});
                            	
                            });
								
							});
		}

		/*管理员-启用*/
		function model_start(obj, id) {
			layer.confirm('确认要启用吗？',
							function(index) {
								//此处请求后台程序，下方是成功后的前台处理……
                           $.post("${ctxPath}/system/model/status/"+id,
                            function(data){ 
								$(obj)
										.parents("tr")
										.find(".td-manage")
										.prepend(
												'<a onClick="model_stop(this,'+id+')" href="javascript:;" title="停用" style="text-decoration:none"><i class="Hui-iconfont">&#xe631;</i></a>');
								$(obj)
										.parents("tr")
										.find(".td-status")
										.html(
												'<span class="label label-success radius">已启用</span>');
								$(obj).remove();
								layer.msg('已启用!', {
									icon : 6,
									time : 1000
								});
							});
			});
								
		}
	</script>
</body>
</html>